import React from "react"
// 这文件是一个配置路由规则的文件
import Login from "../pages/login"

import Home from "../pages/home"

import {HashRouter as Router, Redirect, Route, Switch, Link} from "react-router-dom"

import AuthRoute from "../permission"


class RouterComponent extends React.Component{
  render(){
    return(
      // React.Fragment是一个空标签, 起到包裹的作业, 页面展示的时候没有显示
      <React.Fragment>
        <Router>
        {/* Switch是一个匹配路由的标签, 如碰到这个路由的时候, 就会直接跳转, 不会再找下去了 */}
          <Switch>
            {/* Redirect 是一个重定向 */}
            
            <Route path= "/" exact render= {()=><Redirect to="/home"></Redirect>}></Route>
            <Route path= "/home" exact render= {()=><Redirect to="/home/users"></Redirect>}></Route>
            <AuthRoute path= "/home" component={Home}></AuthRoute>
            <Route path= "/login" component={Login}></Route>
          </Switch>

        </Router>

      </React.Fragment>
    )
  }
}
export default RouterComponent  